<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <h1>我是a.html</h1>
  <button>点击我跳转到b页面</button>
  <script>
    let btn = document.querySelector('button');
    let obj = {
      name: '张三',
      age: 18
    }
    // 通过querystring参数 实现跨页面传参
    btn.onclick = function () {
      // 1.跳转到b.html页面    2.通过查询参携带数据
      location.href = `./b.html?name=${obj.name}&age=${obj.age}`;
    }
  </script>
</body>

</html>